LOYOLA COLLEGE (AUTONOMOUS), CHENNAI –600 034
B.Sc., DEGREE EXAMINATION – STATISTICS
FOURTH SEMESTER – APRIL 2004
ST-4202/STA202 – NUMERICAL METHODS USING ‘C’
14.04.2004 Max:100 marks
9.00 – 12.00
SECTION -A
Answer ALL questions (10 ´ 2 = 20 marks)
- What is an assignment statement? What is the relationship between an assignment statement and an expression statement?
- Mention the difference between pre-increment and post-increment operator.
- Give the syntax of ternary operator.
- What is the output of the following program segment?
for (i = 0, j = 0; i < = 5; i ++, j ++)
print f (” %d\ n”, i+j);
- Mention the difference between break and continue statement.
- What is an array?
- Comment on the following statement:
” scanf () and get char() functions are equivalent”.
- Find the value of f (10) using Lagrange’s linear interpolation for the following function:
x: 7 19
f: 15 35.
- Evaluate using Trapezoidal rule where f(x) is defined as
x: | 0.8 | 0.9 | 1.0 | 1.1 | 1.2 |
f: | 0.71736 | 0.78333 | 0.84147 | 0.92314 | 0.96356 |
- Give the steps to find the root of an equation by Newton-Raphson method.
SECTION – B
Answer any FIVE questions (5 ´ 8 = 40 marks)
- a) Explain the data types available in C.
- b) What are type qualifiers? (6+2)
- Explain the concept of branching and looping with examples.
- Explain the syntax of the following:
- a) printf() b) toupper() c) pow() d) floor()
- Give the output of the following program segments:
- a) i = x = 0; b) x = 0;
do for (i = 0; i<5; i++)
{ {
if (i% 5 = =0) for (j = 0; j<i;j++)
{ {
x++; switch (i+j-1)
printf(“%d \n”, x); {
} case -1:
i++; case 0: x = x+1;
}while (i<20); break;
printf (“%d’1′ x); case 1:
case 2:
case 3: x = x+2;
break;
default: x = x+3;
break;
}
printf (“%d\n”, x);
}
} (3+5)
- a) Write a program to accept an integer and display it in reverse order.
- b) Write a program using function to find the factorial of a given positive integer. (4+4)
- Find the determinant of the following matrix by pivotal condensation method.
- Write a program to solve the equation x2+3x-5=0 using bisection method.
- Write a program to find the largest eigen vector by the method of iteration.
SECTION – C
Answer any TWO questions (2 ´ 20 = 40 marks)
- a) Explain the structure of a C program.
- b) Write a program to find the maximum among ‘n’ given integers.
- c) Explain the concept of arrays with an example. (6+6+8)
- a) Write a program to find the roots of a quadratic equation of the form ax2+bx+c=0.
- b) Write a program to find the sum of 2 square matrices of order mxm.
- c) What are user defined functions? Explain the method of declining and defining a user
defined function. (6+6+8)
- a) Explain the Gauss-elimination method to solve a given set of simultaneous equation
and write a program for the same.
- b) Evaluate using simpson’s 1/3 rule by taking h as 0.1. (12+8)
- a) Write a program using Lagrange’s interpolation method to evaluate f(y) where ‘f’ is a function defined as
x : x1 x2 ……..xn
f(x): f1 f2 ……..fn
Assume that x1, x2…..xn, f1, f2,……fn are known values.
- b) Find the inverse of the following matrix by Gauss-Jordon elimination method.
A = (12+8)
Latest Govt Job & Exam Updates: